package com.liveneo.adapter.mobile.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liveneo.adapter.base.entity.PrpmSurveyUser;
import com.liveneo.adapter.base.mapper.PrpmSurveyUserMapper;
import com.liveneo.adapter.mobile.service.PrpmSurveyUserService;

/**
 * @Desc：
 * @Title：PrpmSurveyUserServiceImpl
 * @address: http://www.liveneo.com.cn/
 * @author: Liuzhipeng
 * @version: 1.0 
 * @date: 2016年10月13日 下午1:54:35
 */
@Service
public class PrpmSurveyUserServiceImpl implements PrpmSurveyUserService {
    @Autowired
    private PrpmSurveyUserMapper prpmSurveyUserMapper;

    @Override
    public PrpmSurveyUser findUserByPhone(String phone) {
        return prpmSurveyUserMapper.findUserByPhone(phone);
    }

    @Override
    public PrpmSurveyUser findUserByUserCode(String userCode) {
        // TODO Auto-generated method stub
        return prpmSurveyUserMapper.findByUserCode(userCode);
    }

	@Override
	public PrpmSurveyUser findUserByUserCodeAndType(String userCode, String userType) {
		Map<String,String> map = new HashMap<String,String>();
		map.put("userCode", userCode);
		map.put("userType", userType);
		return  prpmSurveyUserMapper.findByUserCodeAndType(map);
	}

	/**
	  * @Title: save
	  * @Description: TODO
	  * @param @param surveyUser
	  * @param @return 设定文件
	  * @return 返回类型
	  * @throws
	  */
	@Override
	public int saveSurveyUser(PrpmSurveyUser surveyUser) {
		
		return prpmSurveyUserMapper.insert(surveyUser);
	}

	/**
	  * @Title: update
	  * @Description: TODO
	  * @param @param surveyUser
	  * @param @return 设定文件
	  * @return 返回类型
	  * @throws
	  */
	@Override
	public int updateSurveyUser(PrpmSurveyUser surveyUser) {
		return prpmSurveyUserMapper.updateByPrimaryKeySelective(surveyUser);
	}
}
